package com.netty.prictice.second;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ReplayingDecoder;

import java.util.List;

/**
 * @author shengtao
 * @Description: 解码器
 * @date 2018/09/05 18:17
 */
public class ReplayingTimeDecoder extends ReplayingDecoder<Void>{
    @Override
    protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf in, List<Object> out) throws Exception {
        if(in.readableBytes() < 4){
            return;
        }
        out.add(in.readBytes(4));
    }
}
